function startEffects(){
	var marginTop = ($$("html")[0].getSize().size.y / 2) - $promo.slogan.getSize().size.y;
	$promo.slogan.fx.start({
		"opacity": 1
	}).chain(function(){
		$promo.slogan.fx.setOptions({
			"transition": Fx.Transitions.Bounce.easeOut
		});
		$promo.slogan.fx.start({
			"marginTop": marginTop
		});
	}).chain(function(){
		$promo.phrase.fx.start({
			"opacity": 0.8
		});
	});
}

function promoInit(e){
	$promo = {
		slogan: $$("h1")[0],
		phrase: $$("h2")[0]
	};
	for(var id in $promo){
		var obj = $promo[id];
		obj.setProperty("id", id).setStyles({
			"opacity": 0,
			"cursor": "pointer"
		});
		obj.fx = obj.effects({
			"duration": 1000
		});
		obj.addEvent("click", function(){
			window.location.replace("/pages/members");
		});
	}
	Asset.images(["/images/slogan.jpg", "images/html-bg.gif"], {
		"onComplete": startEffects
	});
}


$(window).addEvent("domready", function(e){
	// Just in promo site
	if($("promo")){
		promoInit(e);
		Asset.images([
			"/images/menu-item.gif", 
			"/images/menu-item-active.gif", 
			"/images/menu-item-hover.gif", 
			"/images/shadow-right.gif", 
			"/images/shadow-left.gif", 
			"/images/shadow-top-right.gif", 
			"/images/shadow-top-left.gif"
		]);
	} else{
		$("title").setStyle("cursor", "pointer").addEvent("click", function(e){
			window.location.replace("/");
		});		
	}
});
